<?php
require_once '../sub/init.php';
if($request=='www_zeai_cn__ajax' && !ifint($cook_tg_uid))json_exit(array('flag'=>'nologin_tg','msg'=>'请您先登录帐号','jumpurl'=>HOST.'/m/tg_my.php'));
if(@!in_array('tg',$navarr))exit("<div style='font-size:30px;text-align:center;margin:50px'>推广功能暂未开启</div>");
require_once ZEAI.'cache/config_reg.php';
require_once ZEAI.'cache/config_shop.php';
require_once ZEAI.'cache/config_vip.php';
require_once ZEAI.'sub/conn.php';
$TG_set = json_decode(stripslashes($_REG['TG_set']),true);
$switch = json_decode($_ZEAI['switch'],true);
require_once ZEAI.'m/tg_insert_init.php';	
if(ifint($cook_tg_uid)){
	$row  = $db->ROW(__TBL_TG_USER__,"subscribe,uid,openid,shopflag,nickname,title,mob","id='".$cook_tg_uid."'","num");
	$data_subscribe = $row[0];
	$data_uid       = $row[1];
	$data_openid    = $row[2];
	$data_shopflag    = $row[3];
	$cook_tg_nickname = trimhtml(dataIO($row[4],'out'));
	$cook_tg_title = trimhtml(dataIO($row[5],'out'));
	$cook_tg_mob = $row[6];
	$cook_tg_nickname = (empty($cook_tg_nickname))?$cook_tg_title:$cook_tg_nickname;
	$cook_tg_nickname = (empty($cook_tg_nickname))?hidetext($cook_tg_mob):$cook_tg_nickname;
	if(empty($data_openid) && ifint($data_uid)){
		$Urow = $db->ROW(__TBL_USER__,"subscribe,openid","id=".$data_uid,"num");
		if ($Urow){
			$Usubscribe     = intval($Urow[0]);
			$data_subscribe = $Usubscribe;
			$Uopenid        = $Urow[1];
			$db->query("UPDATE ".__TBL_TG_USER__." SET subscribe=$Usubscribe,openid='$Uopenid' WHERE id=".$cook_tg_uid);
		}
	}
	if($request=='www_zeai_cn__ajax' && $TG_set['force_subscribe']==1 && $data_subscribe!=1){
		json_exit(array('flag'=>'jumpurl','msg'=>'请您先关注公众号','jumpurl'=>HOST.'/m/tg_subscribe.php'));
	}else{
		if($TG_set['force_subscribe']==1 && $data_subscribe!=1 ){header("Location: ".HOST."/m/tg_subscribe.php");exit;}
	}
}
$currfields = "photo_s,tgallmoney,tgallloveb,grade,money,kind,tgallloveb,tgallmoney,subscribe";
require_once 'tg_chkuser.php';
$data_photo_s=$row['photo_s'];
$data_tgallmoney=str_replace(".00","",$row['tgallmoney']);
$data_tgallloveb=str_replace(".00","",$row['tgallloveb']);
$data_grade=$row['grade'];
$data_kind=$row['kind'];
$data_subscribe=$row['subscribe'];
$data_money=str_replace(".00","",$row['money']);;
$photo_m_url = (!empty($data_photo_s ))?UP.smb($data_photo_s,'m'):HOST.'/res/tg_my_u1.png';
$row_role=$db->ROW(__TBL_TG_ROLE__,"*","shopgrade=0 AND grade=".$data_grade,"name");
$data_gradetitle=$row_role['title'];
$data_logo  =$row_role['logo'];
$reward_kind=$row_role['reward_kind'];

if($reward_kind=='loveb'){//loveb
//	$reg_sex1_num1  = intval($row_role['reg_loveb_sex1_num1']);
//	$reg_sex1_num2  = intval($row_role['reg_loveb_sex1_num2']);
//	$reg_sex2_num1  = intval($row_role['reg_loveb_sex2_num1']);
//	$reg_sex2_num2  = intval($row_role['reg_loveb_sex2_num2']);
	$priceT = $_ZEAI['loveB'];
}elseif($reward_kind=='money'){//元
	$reg_sex1_num1  = floatval($row_role['reg_money_sex1_num1']);
	$reg_sex1_num2  = floatval($row_role['reg_money_sex1_num2']);
	$reg_sex2_num1  = floatval($row_role['reg_money_sex2_num1']);
	$reg_sex2_num2  = floatval($row_role['reg_money_sex2_num2']);

	$cz_sex1_num1  = intval($row_role['cz_sex1_num1']);
	$cz_sex1_num2  = intval($row_role['cz_sex1_num2']);
	$cz_sex2_num1  = intval($row_role['cz_sex2_num1']);
	$cz_sex2_num2  = intval($row_role['cz_sex2_num2']);
	
	$vip_sex1_num1 = intval($row_role['vip_sex1_num1']);
	$vip_sex1_num2 = intval($row_role['vip_sex1_num2']);
	$vip_sex2_num1 = intval($row_role['vip_sex2_num1']);
	$vip_sex2_num2 = intval($row_role['vip_sex2_num2']);

	$rz_sex1_num1 = intval($row_role['rz_sex1_num1']);
	$rz_sex1_num2 = intval($row_role['rz_sex1_num2']);
	$rz_sex2_num1 = intval($row_role['rz_sex2_num1']);
	$rz_sex2_num2 = intval($row_role['rz_sex2_num2']);
	
	$union_reg_num1  = floatval($row_role['union_reg_num1']);
	$union_reg_num2  = floatval($row_role['union_reg_num2']);
	$union_num1 = intval($row_role['union_num1']);
	$union_num2 = intval($row_role['union_num2']);

	$priceT = '元';
}

if(!empty($data_logo)){
	$gradeico_str='<img src="'.UP.$data_logo.'">';
}else{
	$gradeico_str='<img src="'.RES.'tg_ico.svg">';
}
switch ($data_kind) {
	case 1:$kind_str='个人';break;
	case 2:$kind_str='公司';break;
	case 3:$kind_str='机构';break;
}
/*************AJAX页面开始*************/
switch ($submitok) {
	case 'TG_U':
		$nav='tg_my';
		require_once ZEAI.'m/header.php';?>
        <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
		<style>
        .tabmenufix{top:6.7rem}
        .tabmenu a.ed:after{background-color:#EE5A4E}
        </style>
        <?php
        $mini_title='我的单身团';
		$mini_class='top_mini4 bgcolor yunbox';
		require_once ZEAI.'m/top_mini.php';
		//用户
		$rt=$db->query("SELECT COUNT(*) AS num FROM ".__TBL_USER__." WHERE tguid=".$cook_tg_uid);
		$row  = $db->fetch_array($rt,'name');
		$num1 = intval($row['num']);
		$num1 = ($num1>0)?'<b>'.$num1.'</b>':'';
		//团队
		$rt=$db->query("SELECT COUNT(*) AS num FROM ".__TBL_USER__." WHERE tguid IN (SELECT id FROM zeai_tg_user WHERE tguid=".$cook_tg_uid.") ");
		$row  = $db->fetch_array($rt,'name');
		$num2 = intval($row['num']);
		$num2 = ($num2>0)?'<b>'.$num2.'</b>':'';
		?>
        <div class="tabmenu tabmenu2 tabmenufix">
            <a href="tg_my.php?submitok=TG_U&a=list1"<?php echo ($a == 'list1')?' class="ed"':''; ?>>直接推荐<?php echo $num1;?></a>
            <a href="tg_my.php?submitok=TG_U&a=list2"<?php echo ($a == 'list2')?' class="ed"':''; ?>>团队推荐<?php echo $num2;?></a>
        </div>
        <div class="TG_U_box">
			<?php
            $nodatatips = "<div class='nodatatips' style=\"margin-top:2rem\"><i class='ico'>&#xe659;</i>～～您名下还没有成员～～<br>通过我分享的推广海报注册成功即可获得奖励<br><br><a id=\"TG_Uabtn\" class=\"btn size4 yuan TG_Uabtn\" href=\"tg_my_ewm.php\">立即去招募</a></div>";
            $fldU="id,uname,nickname,sex,grade,photo_s,photo_f,areatitle,birthday,heigh,regtime,tgflag";
            //我的单身团团队
            if($a == 'list2'){
                $rt=$db->query("SELECT $fldU FROM ".__TBL_USER__." WHERE tguid IN (SELECT id FROM zeai_tg_user WHERE tguid=".$cook_tg_uid.") ORDER BY id DESC");
                //$dlcls=' class="fadeInL"';
            //我的单身团
            }else{
                //$dlcls=' class="fadeInR"';
                $rt=$db->query("SELECT $fldU FROM ".__TBL_USER__." WHERE tguid=".$cook_tg_uid." ORDER BY id DESC");
            }
            $total = $db->num_rows($rt);
            if ($total > 0) {
                for($i=1;$i<=$total;$i++) {
                    $rows = $db->fetch_array($rt,'name');
                    if(!$rows)break;
                    $uid     = $rows['id'];
                    $uname    = dataIO($rows['uname'],'out');
                    $nickname = dataIO($rows['nickname'],'out');
                    $sex      = $rows['sex'];
                    $grade    = $rows['grade'];
                    $photo_s  = $rows['photo_s'];
                    $photo_f  = $rows['photo_f'];
                    $areatitle= $rows['areatitle'];
                    $birthday = $rows['birthday'];
                    $heigh    = $rows['heigh'];
                    $tgflag   = $rows['tgflag'];
                    $regtime  = date_str($rows['regtime']);
                    //
                    $nickname = (empty($nickname))?$uname:$nickname;
                    $birthday_str  = (getage($birthday)<=0)?'':getage($birthday).'岁　';
                    $heigh_str     = (empty($heigh))?'':$heigh.'cm　';
                    $aARR = explode(' ',$areatitle);$areatitle = $aARR[1].$aARR[2];
                    $areatitle_str = (empty($areatitle))?'':$areatitle;
                    $photo_s_url = (!empty($photo_s) && $photo_f==1)?UP.$photo_s:RES.'photo_m'.$sex.'.png';
                    $photo_s_url = (ifmLockBlur() && !empty($photo_s))?RES.'photo_m'.$sex.'_hide.png':$photo_s_url;
                    $tgflag_str  = ($tgflag == 1)?'<span class="ed">已奖励</span>':'<span>待验证</span>';
                    ?>
                    <dl<?php echo $dlcls;?>>
                        <dt><a href="<?php echo mHref('u',$uid);?>"><img src="<?php echo $photo_s_url; ?>"></a></dt>
                        <dd><h4><?php echo uicon($sex.$grade);?><span><?php echo $nickname; ?></span></h4><h6><?php echo $birthday_str.$heigh_str; ?><?php echo $areatitle_str; ?></h6></dd>
                        <div class="time"><?php echo $regtime; ?></div>
                        <div class="tgflag"><?php echo $tgflag_str; ?></div>
                    </dl>
            <?php }}else{echo $nodatatips;}?>
        </div>
		<?php
		require_once ZEAI.'m/tg_bottom.php';
		exit;
	break;
	case 'TG_TD':
		$nav='tg_my';
		require_once ZEAI.'m/header.php';?>
        <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
		<style>
        .tabmenufix{top:6.7rem}
        .tabmenu a.ed:after{background-color:#EE5A4E}
        </style>
        <?php
		$mini_title='我的合伙人';
		$mini_class='top_mini4 bgcolor yunbox';
		require_once ZEAI.'m/top_mini.php';
		//合伙人
		$rt=$db->query("SELECT COUNT(*) AS num FROM ".__TBL_TG_USER__." WHERE tguid=".$cook_tg_uid." ");
		$row  = $db->fetch_array($rt,'name');
		$num1 = intval($row['num']);
		$num1 = ($num1>0)?'<b>'.$num1.'</b>':'';
		//团队
		$rt=$db->query("SELECT COUNT(*) AS num FROM ".__TBL_TG_USER__." WHERE tguid IN (SELECT id FROM zeai_tg_user WHERE tguid=".$cook_tg_uid.") ");
		$row  = $db->fetch_array($rt,'name');
		$num2 = intval($row['num']);
		$num2 = ($num2>0)?'<b>'.$num2.'</b>':'';
		?>
        <div class="tabmenu tabmenu2 tabmenufix">
            <a href="tg_my.php?submitok=TG_TD&a=list1"<?php echo ($a == 'list1')?' class="ed"':''; ?>>直接推荐<?php echo $num1;?></a>
            <a href="tg_my.php?submitok=TG_TD&a=list2"<?php echo ($a == 'list2')?' class="ed"':''; ?>>团队推荐<?php echo $num2;?></a>
        </div>
        <div class="TG_U_box">
			<?php 
            $nodatatips = "<div class='nodatatips'><i class='ico'>&#xe659;</i>～～你还没有发展小伙伴～～<div>通过我分享的分享二维码加入即可成为我的团队成员，发展的我团队，让收益迅速暴增</div><a id=\"TG_Uabtn\" class=\"btn size4 yuan TG_Uabtn\" href=\"tg_my_ewm.php\">立即去招募</a></div>";
			//我的团队
			if($submitok == 'list2'){
				$rt=$db->query("SELECT id,uname,nickname,photo_s,regtime,tgallmoney,tgflag,tgmoney FROM ".__TBL_TG_USER__." WHERE tguid IN (SELECT id FROM zeai_tg_user WHERE tguid=".$cook_tg_uid.") ORDER BY id DESC");
				$dlcls=' class="fadeInL"';
			//我的合伙人
			}else{
				$dlcls=' class="fadeInR"';
				$rt=$db->query("SELECT id,uname,nickname,photo_s,regtime,tgallmoney,tgflag,tgmoney FROM ".__TBL_TG_USER__." WHERE tguid=".$cook_tg_uid." ORDER BY id DESC");
			}
			$total = $db->num_rows($rt);
			if ($total > 0) {
				for($i=1;$i<=$total;$i++) {
					$rows = $db->fetch_array($rt,'name');
					if(!$rows)break;
					$uname    = dataIO($rows['uname'],'out');
					$nickname = trimhtml(dataIO($rows['nickname'],'out'));
					$sex      = 0;
					$idd      = $rows['id'];
					$grade    = $rows['grade'];
					$photo_s  = $rows['photo_s'];
					$tgallmoney = $rows['tgallmoney'];
					$regtime  = YmdHis($rows['regtime']);
					$tgflag   = $rows['tgflag'];
					$tgmoney  = $rows['tgmoney'];
					//
					$nickname = (empty($nickname))?$uname:$nickname;
					$nickname = (empty($nickname))?'ID:'.$idd:$nickname;
					$photo_s_url = (!empty($photo_s))?UP.$photo_s:RES.'photo_m'.$sex.'.png';
					$clsname = ($tgmoney > 0)?' ed':'';	
					$tgmoney = str_replace("0.00","",$tgmoney);
					if($tgmoney > 0){
						$tgmoney=$tgmoney.'<span>'.$priceT.'</span>';
					}
					switch ($tgflag) {
						case 1:$tgflag_str = '<fnot class="C090">已奖励</font>';break;
						case 2:$tgflag_str = '已驳回';break;
						case 0:$tgflag_str = '待审核';break;
					}
					?>
					<dl<?php echo $dlcls;?>>
						<dt><a><img src="<?php echo $photo_s_url; ?>"></a></dt>
						<dd><h4><span><?php echo $nickname; ?></span></h4><h6><?php echo $regtime; ?></h6></dd>
						<div class="time"><?php echo $tgflag_str;?></div>
						<div class="price<?php echo $clsname;?>"><?php echo $tgmoney; ?></div>
					</dl>
			<?php }}else{echo $nodatatips;}?>
        </div>
		<?php
		require_once ZEAI.'m/tg_bottom.php';
        exit;break;
	case 'TG_MSG':
		$nav='tg_msg';
		require_once ZEAI.'m/header.php';?>
        <script src="<?php echo RES;?>m/js/TG2.js?<?php echo $_ZEAI['cache_str'];?>"></script>
        <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
        <?php
		$nodatatips = "<div class='nodatatips'><i class='ico'>&#xe608;</i>暂时木有内容</div>";
		$mini_title='系统通知';
		$mini_class = 'top_mini4 ';
		$mini_R = '<a id="TG_MSG_btndel">清空</a>';
		require_once ZEAI.'m/top_mini.php';?>
		<div class="TG_MSG" id="TG_MSGbox">
			<?php 
			$_ZEAI['pagesize'] = 100;
			$rt=$db->query("SELECT id,title,new,addtime FROM ".__TBL_TIP__." WHERE tg_uid=".$cook_tg_uid." AND kind=5 ORDER BY id DESC LIMIT ".$_ZEAI['pagesize']);//推荐
			$total = $db->num_rows($rt);
			if ($total > 0) {
				for($i=1;$i<=$total;$i++) {
					$rows = $db->fetch_array($rt,'num');
					if(!$rows)break;
					$id    = $rows[0];
					$title = dataIO($rows[1],'out');
					$new   = $rows[2];
					$addtime_str = date_str($rows[3]);
					$new_str = ($new == 1)?'<b></b>':'';
					$img_str = '<i class="ico k1">&#xe657;</i>';
					$kind_str = '';
					$content = dataIO($rows[2],'out');?>
                    <dl>
                        <dt tid="<?php echo $id; ?>"><?php echo $img_str; ?><?php echo $new_str; ?></dt>
                        <dd><h4><?php echo $title; ?></h4></dd>
                        <span><?php echo $addtime_str; ?></span>
                        <strong>删除</strong>
                    </dl>
					<?php
				}?>
				<script>
				TG_MSGFn();
				TG_MSG_btndel.onclick=function(){
					ZeaiM.confirmUp({title:'确定清空全部系统通知么？',cancel:'取消',ok:'确定清空',okfn:function(){
						zeai.ajax({url:'tg_my'+zeai.extname,data:{submitok:'ajax_MSG_clean'}},function(e){rs=zeai.jsoneval(e);
							if(rs.flag==1){TG_MSGbox.html("<?php echo $nodatatips;?>");tg_num_btm.remove();}
						});
					}});
				}
				</script>
				<?php
			}else{echo $nodatatips;}?>
		</div>
		<?php
		require_once ZEAI.'m/tg_bottom.php';
	exit;break;
	case 'TG_MSG_detail':
		if(!ifint($tid))exit(JSON_ERROR);
		$row = $db->ROW(__TBL_TIP__,"content,new,addtime","tg_uid=".$cook_tg_uid." AND kind=5 AND id=".$tid);
		if ($row){
			$content = dataIO($row[0],'out');
			$new     = $row[1];
			$addtime = YmdHis($row[2]);
			if ($new == 1){
				$db->query("UPDATE ".__TBL_TIP__." SET new=0 WHERE kind=5 AND id=".$tid." AND tg_uid=".$cook_tg_uid);
			}
		}else{exit('Forbidden');}
		$nav='tg_msg';
		require_once ZEAI.'m/header.php';
		$mini_title='系统通知';
		$mini_class = 'top_mini4 ';
		require_once ZEAI.'m/top_mini.php';?>
        <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
		<div class="TG_MSG_detail">
			<div id="TG_MSG_msgC"><?php echo $content;?></div>
			<div class="linebox"><div class="line "></div><div class="title BAI S14 C999"><?php echo $addtime; ?></div></div>
		</div>
		<script>zeai.listEach(zeai.tag(TG_MSG_msgC,'a'),function(a){a.remove();});</script>
		<?php
		require_once ZEAI.'m/tg_bottom.php';
        exit;break;
	case 'ajax_MSG_del':
		if(!ifint($tid))exit(JSON_ERROR);
		$db->query("DELETE FROM ".__TBL_TIP__." WHERE kind=5 AND tg_uid=".$cook_tg_uid." AND id=".$tid);
		json_exit(array('flag'=>1));
	exit;break;
	case 'ajax_MSG_clean':
		$db->query("DELETE FROM ".__TBL_TIP__." WHERE kind=5 AND tg_uid=".$cook_tg_uid);
		json_exit(array('flag'=>1));
	exit;break;
	case 'TG_HELP':
		$nav='tg_help';
		require_once ZEAI.'m/header.php';
		$mini_title='推广奖励・说明';
		require_once ZEAI.'m/top_mini.php';?>
        <link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
		<div class="TG_HELP">
			<h2><?php echo $data_gradetitle;?>收益是怎么算的?</h2>
			<ul class="sy">
                <?php if ($reg_sex1_num1>0 || $reg_sex2_num1>0 || $reg_sex1_num2>0 || $reg_sex2_num2>0){?>
				<li>
					<h5>单身用户注册</h5>
					<p>直接奖励：男<b> <?php echo ($reg_sex1_num1>0)?$reg_sex1_num1.$priceT.'/人':'无';?></b>　女<b> <?php echo ($reg_sex2_num1>0)?$reg_sex2_num1.$priceT.'/人':'无';?></b> <br>(您直接分享注册的用户，一级小伙伴)</p>
					<p>团队奖励：男<b> <?php echo ($reg_sex1_num2>0)?$reg_sex1_num2.$priceT.'/人':'无';?></b>　女<b> <?php echo ($reg_sex2_num2>0)?$reg_sex2_num2.$priceT.'/人':'无';?></b> <br>(您的一级小伙伴成员又分享注册了用户)</p>
					<?php echo ($TG_set['reward_flag'] == 1)?'':'<em>注：为防刷单，网站开启了验证功能，新注册用户需客服人员核验真实有效后奖励，已注册的用户【充值/升VIP/认证】直接奖励无需审核</em>';?>
				</li>
                <?php }
				if ($cz_sex1_num1>0 || $cz_sex2_num1>0 || $cz_sex1_num2>0 || $cz_sex2_num2>0){?>
				<li>
					<h5>单身用户在线充值</h5>
					<p>直接奖励：男<b><?php echo ($cz_sex1_num1>0)?$cz_sex1_num1.'%':'无';?></b>　女<b><?php echo ($cz_sex2_num1>0)?$cz_sex2_num1.'%':'无';?></b></p>
					<p>团队奖励：男<b><?php echo ($cz_sex1_num2>0)?$cz_sex1_num2.'%':'无';?></b>　女<b><?php echo ($cz_sex2_num2>0)?$cz_sex2_num2.'%':'无';?></b></p>
				</li>
                <?php }
                if ($vip_sex1_num1>0 || $vip_sex2_num1>0 || $vip_sex1_num2>0 || $vip_sex2_num2>0){?>
				<li>
					<h5>单身用户开通VIP</h5>
					<p>直接奖励：男<b><?php echo ($vip_sex1_num1>0)?$vip_sex1_num1.'%':'无';?></b>　女<b><?php echo ($vip_sex2_num1>0)?$vip_sex2_num1.'%':'无';?></b></p>
					<p>团队奖励：男<b><?php echo ($vip_sex1_num2>0)?$vip_sex1_num2.'%':'无';?></b>　女<b><?php echo ($vip_sex2_num2>0)?$vip_sex2_num2.'%':'无';?></b></p>
				</li>
                <?php }
				if ($rz_sex1_num1>0 || $rz_sex1_num1>0 || $rz_sex2_num2>0 || $rz_sex2_num2>0){?>
				<li>
					<h5>单身用户认证奖励（实名+真人）</h5>
					<p>直接奖励：男<b><?php echo ($rz_sex1_num1>0)?$rz_sex1_num1.'%':'无';?></b>　女<b><?php echo ($rz_sex1_num1>0)?$rz_sex2_num1.'%':'无';?></b></p>
					<p>团队奖励：男<b><?php echo ($rz_sex2_num2>0)?$rz_sex1_num2.'%':'无';?></b>　女<b><?php echo ($rz_sex2_num2>0)?$rz_sex2_num2.'%':'无';?></b></p>
				</li>
                <?php }
                if ($union_reg_num1>0 || $union_reg_num2>0){?>
				<li>
					<h5>合伙人注册<font>(推广员推荐推广员)</font></h5>
					<?php if ($union_reg_num1>0){?><p>直接奖励：<b><?php echo $union_reg_num1;?><?php echo $priceT;?></b>/个</b></p><?php }?>
					<?php if ($union_reg_num2>0){?><p>团队奖励：<b><?php echo $union_reg_num2;?><?php echo $priceT;?></b>/个</b></p><?php }?>
				</li>
                <?php }
                if ($union_num1>0 || $union_num2>0){?>
				<li>
					<h5>合伙人激活/升级<font>(推广员推荐推广员)</font></h5>
                  	<p>您分享注册的推广员激活帐号或升级至更高级别的推广员</p>
					<?php if ($union_num1>0){?><p>直接奖励：<b><?php echo $union_num1;?>%</b></p><?php }?>
					<?php if ($union_num2>0){?><p>团队奖励：<b><?php echo $union_num2;?>%</b></p><?php }?>
				</li>
                <?php }?>
			</ul><br>
			<h2>如何分享？</h2>
			<ul class="sy">
				<li>
					<h5>1.分享/发送我的专属二维码分享海报给好友</h5>
					<input type="button" value="下载我的二维码" class="btn size4 LV2 tgpicdown" onclick="zeai.openurl('tg_my_ewm.php')">
					<br><h5>2.公众号菜单直接呼出分享海报二维码</h5>
					在公众号菜单点【我的】然后点【我要分享】，即可自动呼出您的专属二维码
					<br><br><h5>3.进入分享页面，点击微信右上角分享给好友或朋友圈进行分享</h5>
					<input type="button" value="进入分享页面" class="btn size4 LV2 tgpicdown" onclick="zeai.openurl('tg_my_ewm.php')">
					<br><h5>4.网址分享，可以把网址和文字一起发送给好友微信或QQ等，开始把下面的绿色部分文字和网址复制给你朋友吧</h5>
                    <?php $tglink = HOST.'/m/reg.php?tguid='.$cook_tg_uid;?>
					<div class="C090"><?php $echo=str_replace("{tglink}",$tglink,dataIO($TG_set['tg_text'],'out'));echo $echo;?>
                    <input type="button" value="复制网址文本" class="btn size4 LV2 tgpicdown"  onclick="zeai.copy('<?php echo $echo;?>',function(){zeai.msg('复制成功');})">
                    </div>
				</li>
			
			</ul>
		</div>
		<?php
        require_once ZEAI.'m/tg_bottom.php';
		exit;
	break;
}
$headertitle = '我的'.$TG_set['navtitle'].'-';$nav = 'tg_my';require_once ZEAI.'m/header.php';
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>
	wx.config({debug: false,
		appId: '<?php echo $signPackage["appId"];?>',
		timestamp: <?php echo $signPackage["timestamp"];?>,
		nonceStr: '<?php echo $signPackage["nonceStr"];?>',
		signature: '<?php echo $signPackage["signature"];?>',
		jsApiList: ['chooseImage','uploadImage','previewImage','hideMenuItems','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']
	});
	</script>
	<?php
}
$cook_tg_uname = (empty($cook_tg_uname))?$cook_tg_mob:$cook_tg_uname;
$rt=$db->query("SELECT SUM(money) AS txallmoney FROM ".__TBL_PAY__." WHERE kind=-1 AND tg_uid=".$cook_tg_uid);
$row=$db->fetch_array($rt,'name');
$txallmoney = floatval($row['txallmoney']);
$txallmoney=str_replace(".00","",$txallmoney);?>
<link href="<?php echo RES;?>m/css/TG2.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<style>
.topbg{background:url('<?php echo RES;?>tg_bg.jpg') center;background-size:100% 100%}
.col2 a:nth-child(1) em{background-image:-webkit-linear-gradient(left,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.4),rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,1))}
.col2 a:nth-child(2) em{background-image:-webkit-linear-gradient(135deg,#fc0,#f60)}
.col2 .vip{background-image:-webkit-linear-gradient(left,rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.5),rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.8))}
.col2 .vip2{background-image:-webkit-linear-gradient(left,#FD9F23,#ff7e00);}
body{background-color:#f5f5f5}
<?php if(empty($TG_set['tx_num_list'])){echo 'ul.navT li{width:50%}';}?>
</style>
<?php if(@!in_array('tg',$navarr))exit("<div class='nodatatips'><i class='ico'>&#xe61f;</i>推广功能暂未开启</div>");?>
<i class="ico goback Ugoback" onClick="zeai.back()" style="z-index:1">&#xe602;</i>
<div class="topbg">
    <div class="tg_title"><?php echo $TG_set['navtitle'];?></div>
    <div class="photo_s">
        <img src="<?php echo $photo_m_url;?>" class="m" id="photo_s_id" onclick="zeai.openurl('tg_my_info.php?a=data1')">
        <?php
		if ($TG_set['company_switch'] == 1 && @in_array('shop',$navarr)){
			if($data_shopflag==2){
				$shopgradetitle = '商家入驻';
				$shopurl = 'shop_my_vip.php';
			}elseif($data_shopflag==0){
				$shopgradetitle = '商家入驻';
				$shopurl = 'shop_my_apply.php';
			}elseif($data_shopflag==-1){
				$shopurl = '';
			}else{
				$shopgradetitle = '店铺中心';
				$shopurl = 'shop_my.php';
			}?>
			<a class="unionapply" href="<?php echo $shopurl;?>"><?php echo $shopgradetitle;?><i class="ico S14">&#xe601;</i></a>
        <?php }?>
        <em>
            <h4><?php echo $cook_tg_nickname.'<font class="S12">（ID:'.$cook_tg_uid.'）</font>';?></h4>
            <span<?php if ($TG_set['openvip'] == 1){?> onClick="zeai.openurl('tg_my_vip.php')"<?php }?>><?php echo $gradeico_str.$data_gradetitle;?></span>
        </em>
    </div>
</div>
<div class="clear"></div>
<ul class="navT">
    <li onclick="zeai.openurl('tg_my_money.php?a=mx&i=sy')"><dd>累计收益</dd><dt><b><font>￥</font><?php echo str_replace(".00","",number_format($data_tgallmoney,2));?></b></dt></li>
    <?php if(!empty($TG_set['tx_num_list'])){ ?>
    <li onclick="zeai.openurl('tg_my_money.php?a=mx&i=tx')"><dd>累计提现</dd><dt><b id="tg_tx_allmoney"><font>￥</font><?php echo str_replace(".00","",number_format($txallmoney,2));?></b></dt></li>
    <?php }?>
    <li onclick="zeai.openurl('tg_my_money.php')"><dd>账户余额</dd><dt><b><font>￥</font><?php echo str_replace(".00","",number_format($data_money,2));?></b></dt></li>
    <div class="clear"></div>
    <a class="btn size4 yuan" href="tg_my_ewm.php"><i class="ico">&#xe61d;</i> 立即推广</a>
</ul>
<div class="col2">
    <a href="tg_my.php?submitok=TG_U&a=list1"><h2>名下单身团<i class="ico">&#xe601;</i></h2><h6>我推荐的单身用户</h6>
        <div class="vip"><?php echo intval($db->COUNT(__TBL_USER__,"tguid=".$cook_tg_uid));?>人</div>
        <em class="ico">&#xe617;</em>
    </a>
    <a href="tg_my.php?submitok=TG_TD&a=list1"><h2>名下合伙人<i class="ico">&#xe601;</i></h2>
    <h6>我推荐的推广员</h6>
    <div class="vip2"><?php echo intval($db->COUNT(__TBL_TG_USER__,"tguid=".$cook_tg_uid));?>人</div>
    <em class="ico">&#xe613;</em></a>
</div>
<div class="menu_my">
    <ul>
        <?php if ($TG_set['openvip'] == 1){?><li onclick="zeai.openurl('tg_my_vip.php')"><i class="ico vip">&#xe611;</i><h4>推广升级</h4><span>多重奖励机制，收益翻翻</span></li><?php }?>
        <?php if(@in_array('xqcard',$navarr)){?><li onclick="zeai.openurl('tg_my_ucard.php?t=ext&photo_s=1')"><i class="ico xqk">&#xe6b6;</i><h4>相亲卡片</h4><span>分享相亲卡拿奖励</span></li><?php }?>
        <li onclick="zeai.openurl('tg_my.php?submitok=TG_MSG')"><i class="ico xttz">&#xe657;</i><h4>系统通知</h4><?php echo $tgtipnum_str;?></li>
        <li onclick="zeai.openurl('tg_my_info.php?a=tg_my_set')"><i class="ico account">&#xe678;</i><h4>账户/安全</h4></li>
        <li onclick="zeai.openurl('tg_my_money.php?a=mx&i=sy')"><i class="ico symx">&#xe68f;</i><h4>收益明细</h4></li>
        <?php if(!empty($TG_set['tx_num_list'])){ ?>
        <li onclick="zeai.openurl('tg_my_money.php?a=tx')"><i class="ico wytx">&#xe650;</i><h4>我要提现</h4></li>
        <li onclick="zeai.openurl('tg_my_money.php?a=mx&i=tx')"><i class="ico txjl">&#xe64f;</i><h4>提现记录</h4></li>
        <?php }?>
    </ul>
</div>
<div class="tg_myblank"><button type="button" onClick="zeai.openurl('<?php echo HOST;?>/loginout.php?url=<?php echo HOST;?>/m/tg_index.php')" class="btn size4 BAI my_exit">退出当前帐号</button></div>
<div class="storeapplybox" id="storeapplybox">
    <div class="linebox"><div class="line W50"></div><div class="title S24 BAI B" style="color:#FF5065">联盟合作</div></div>
    <h4>结合线下实体店成为联盟商户，联盟成员可以在平台获得更多品牌曝光，机构用户可以帮助员工及更多客户提供一个严肃真实的婚恋平台</h4>
    <div>
        <a onclick="page({g:'tg_my_info.php?a=apply&i=2',l:'tg_my_info'});applaydiv.click();" class="btn size4 ed">商户合作</a>
        <a onclick="page({g:'tg_my_info.php?a=apply&i=3',l:'tg_my_info'});applaydiv.click();" class="btn size4">机构合作</a>
    </div>
</div>    
<script src="<?php echo RES;?>m/js/TG2.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php require_once ZEAI.'m/tg_bottom.php';	?>